package com.wdh.kjs.activity;

import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.wdh.kjs.MainActivity;
import com.wdh.kjs.R;

/**
 * Created by feifei on 2016/4/27.
 */
public class InvestNowActivity extends BaseTopActivity implements View.OnClickListener {
    private TextView tv_in_payee;
    private TextView tv_in_account;
    private TextView tv_in_bank;
    private TextView tv_in_payment;
    private TextView tv_in_remark;
    private Intent intent;
    private String money;
    private LinearLayout update_trading_forget;
    private TextView ii_right;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_investnow);
        initview();
        initwidge();

    }

    private void initwidge() {
        money = getIntent().getStringExtra("money");
        tv_in_payment.setText(money);
        ii_right.setOnClickListener(this);
        tv_in_remark.setOnClickListener(this);
    }

    private void initview() {
        initTopBar("投资支付");
        ii_right = (TextView) findViewById(R.id.ii_right);
        update_trading_forget = (LinearLayout) findViewById(R.id.update_trading_forget);
        tv_in_payee = (TextView) findViewById(R.id.tv_in_payee);
        tv_in_account = (TextView) findViewById(R.id.tv_in_account);
        tv_in_bank = (TextView) findViewById(R.id.tv_in_bank);
        tv_in_payment = (TextView) findViewById(R.id.tv_in_payment);
        update_trading_forget.setVisibility(View.VISIBLE);
        ii_right.setText("返回首页");
        String str="       转账时，请您务必备注投资单号；转账成功后，请您务必到“我的账户-投资管理-投资记录”点击“已完成转账”，项目融资结束前，我们若未收到您的确认，此订单将会被退款。快金所收到款项后，将短信通知您！";
        int fstart=str.indexOf("“我的账户-投资管理-投资记录”");
        int fend=fstart+"“我的账户-投资管理-投资记录”".length();
        SpannableStringBuilder style=new SpannableStringBuilder(str);
        style.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorPrimary)),fstart,fend,Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        int fstart_2=str.indexOf("“已完成转账”");
        int fend_2=fstart_2+"“已完成转账”".length();
        SpannableStringBuilder style_2=new SpannableStringBuilder(style);
        style_2.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorPrimary)),fstart_2,fend_2,Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        tv_in_remark = (TextView) findViewById(R.id.tv_in_remark);
        tv_in_remark.setText(style_2);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_in_remark:
                intent = new Intent(this, InvestManageActivity2.class);
                startActivity(intent);
                break;
            case R.id.ii_right:
                intent = new Intent(this, MainActivity.class);
                startActivity(intent);
                break;
        }
    }
}
